.class public Lcom/melesta/engine/EngineActivity$SessionStatusCallback;
.super Ljava/lang/Object;
.source "EngineActivity.java"

# interfaces
.implements Lcom/facebook/Session$StatusCallback;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/melesta/engine/EngineActivity;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "SessionStatusCallback"
.end annotation


# instance fields
.field private callback:I

.field private final mRequestPermissions:Z

.field final synthetic this$0:Lcom/melesta/engine/EngineActivity;

.field private userData:I


# direct methods
.method public constructor <init>(Lcom/melesta/engine/EngineActivity;II)V
    .locals 1
    .parameter
    .parameter "user_data"
    .parameter "callback"

    .prologue
    const/4 v0, 0x0

    .line 207
    iput-object p1, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->this$0:Lcom/melesta/engine/EngineActivity;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 202
    iput-boolean v0, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->mRequestPermissions:Z

    .line 204
    iput v0, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->userData:I

    .line 205
    iput v0, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->callback:I

    .line 208
    iput p2, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->userData:I

    .line 209
    iput p3, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->callback:I

    .line 210
    return-void
.end method

.method static synthetic access$000(Lcom/melesta/engine/EngineActivity$SessionStatusCallback;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 201
    iget v0, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->userData:I

    return v0
.end method

.method static synthetic access$100(Lcom/melesta/engine/EngineActivity$SessionStatusCallback;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 201
    iget v0, p0, Lcom/melesta/engine/EngineActivity$SessionStatusCallback;->callback:I

    return v0
.end method


# virtual methods
.method public call(Lcom/facebook/Session;Lcom/facebook/SessionState;Ljava/lang/Exception;)V
    .locals 9
    .parameter "session"
    .parameter "state"
    .parameter "exception"

    .prologue
    .line 215
    :try_start_0
    const-string v5, "engine"

    const-string v6, "SessionStatusCallback(%s, %s, %s)"

    const/4 v7, 0x3

    new-array v7, v7, [Ljava/lang/Object;

    const/4 v8, 0x0

    aput-object p1, v7, v8

    const/4 v8, 0x1

    aput-object p2, v7, v8

    const/4 v8, 0x2

    aput-object p3, v7, v8

    invoke-static {v6, v7}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 216
    invoke-static {}, Lcom/melesta/engine/EngineActivity;->getInstance()Lcom/melesta/engine/EngineActivity;

    move-result-object v0

    .line 217
    .local v0, ea:Lcom/melesta/engine/EngineActivity;
    invoke-virtual {p1}, Lcom/facebook/Session;->isOpened()Z

    move-result v5

    if-eqz v5, :cond_3

    if-nez p3, :cond_3

    .line 218
    const-string v5, "engine"

    const-string v6, "session.isOpened() && (exception == null)"

    const/4 v7, 0x0

    new-array v7, v7, [Ljava/lang/Object;

    invoke-static {v6, v7}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 219
    invoke-virtual {p1}, Lcom/facebook/Session;->getPermissions()Ljava/util/List;

    move-result-object v3

    .line 220
    .local v3, permissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    sget-object v5, Lcom/melesta/engine/FacebookOperations;->READ_PERMISSIONS:Ljava/util/List;

    invoke-interface {v3, v5}, Ljava/util/List;->containsAll(Ljava/util/Collection;)Z

    move-result v5

    if-nez v5, :cond_1

    .line 221
    const-string v5, "facebook"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "permissions: "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v3}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 223
    new-instance v5, Lcom/facebook/Session$NewPermissionsRequest;

    sget-object v6, Lcom/melesta/engine/FacebookOperations;->READ_PERMISSIONS:Ljava/util/List;

    invoke-direct {v5, v0, v6}, Lcom/facebook/Session$NewPermissionsRequest;-><init>(Landroid/app/Activity;Ljava/util/List;)V

    invoke-virtual {p1, v5}, Lcom/facebook/Session;->requestNewReadPermissions(Lcom/facebook/Session$NewPermissionsRequest;)V

    .line 279
    .end local v0           #ea:Lcom/melesta/engine/EngineActivity;
    .end local v3           #permissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :cond_0
    :goto_0
    return-void

    .line 228
    .restart local v0       #ea:Lcom/melesta/engine/EngineActivity;
    .restart local v3       #permissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :cond_1
    sget-object v5, Lcom/melesta/engine/FacebookOperations;->PUBLISH_PERMISSIONS:Ljava/util/List;

    invoke-interface {v3, v5}, Ljava/util/List;->containsAll(Ljava/util/Collection;)Z

    move-result v5

    if-nez v5, :cond_2

    .line 238
    sget-object v4, Lcom/melesta/engine/FacebookOperations;->PUBLISH_PERMISSIONS:Ljava/util/List;

    .line 239
    .local v4, permissions2:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    new-instance v2, Lcom/facebook/Session$NewPermissionsRequest;

    invoke-direct {v2, v0, v4}, Lcom/facebook/Session$NewPermissionsRequest;-><init>(Landroid/app/Activity;Ljava/util/List;)V

    .line 241
    .local v2, newPermissionsRequest:Lcom/facebook/Session$NewPermissionsRequest;
    invoke-virtual {p1, v2}, Lcom/facebook/Session;->requestNewPublishPermissions(Lcom/facebook/Session$NewPermissionsRequest;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 276
    .end local v0           #ea:Lcom/melesta/engine/EngineActivity;
    .end local v2           #newPermissionsRequest:Lcom/facebook/Session$NewPermissionsRequest;
    .end local v3           #permissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .end local v4           #permissions2:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :catch_0
    move-exception v1

    .line 277
    .local v1, exc:Ljava/lang/Exception;
    const-string v5, "SessionStatusCallback"

    invoke-static {v5, v1}, Lcom/melesta/engine/Error;->processException(Ljava/lang/String;Ljava/lang/Exception;)V

    goto :goto_0

    .line 245
    .end local v1           #exc:Ljava/lang/Exception;
    .restart local v0       #ea:Lcom/melesta/engine/EngineActivity;
    .restart local v3       #permissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :cond_2
    if-eqz v0, :cond_0

    .line 246
    :try_start_1
    new-instance v5, Lcom/melesta/engine/EngineActivity$SessionStatusCallback$1;

    invoke-direct {v5, p0, v0}, Lcom/melesta/engine/EngineActivity$SessionStatusCallback$1;-><init>(Lcom/melesta/engine/EngineActivity$SessionStatusCallback;Lcom/melesta/engine/EngineActivity;)V

    invoke-virtual {v0, v5}, Lcom/melesta/engine/EngineActivity;->runOnGLThread(Ljava/lang/Runnable;)V

    goto :goto_0

    .line 265
    .end local v3           #permissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :cond_3
    const-string v5, "engine"

    const-string v6, "SessionStatusCallback OnLogout"

    invoke-static {v5, v6}, Lcom/melesta/engine/Log;->d(Ljava/lang/String;Ljava/lang/String;)V

    .line 267
    if-eqz v0, :cond_0

    .line 268
    new-instance v5, Lcom/melesta/engine/EngineActivity$SessionStatusCallback$2;

    invoke-direct {v5, p0}, Lcom/melesta/engine/EngineActivity$SessionStatusCallback$2;-><init>(Lcom/melesta/engine/EngineActivity$SessionStatusCallback;)V

    invoke-virtual {v0, v5}, Lcom/melesta/engine/EngineActivity;->runOnGLThread(Ljava/lang/Runnable;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0
.end method
